Acala

Row

id tvlUSD volumeUSD_24H volumeUSD_7D tvlUSD_DEX volumeUSD_24H_DEX volumeUSD_7D_DEX TVL_Difference
lp://AUSD/LDOT 705,194.6 110.6705 208516.8 1,410,389 2456.427 530775 705,194.5884
lp://DOT/LCDOT 4,776,888.5 7358.981 1797596 4,764,086 11667.74 2020679 12,802.7197
lp://AUSD/LCDOT 2,352,385.3 3782.542 1456086 2,346,131 3772.322 1494271 6,254.0005
lp://ACA/AUSD 2,854,271.4 10788.07 2411708 2,853,935 10807.1 2501658 336.2601

Karura

Row

id tvlUSD volumeUSD_24H volumeUSD_7D tvlUSD_DEX volumeUSD_24H_DEX volumeUSD_7D_DEX TVL_Difference
lp://KBTC/AUSD -1,003,837.638 -466.757 -6751.802 NA NULL NULL NA
lp://KINT/AUSD -1,139,785.135 -398.3208 -6357.224 NA NULL NULL NA
lp://PHA/AUSD -917,426.691 -781.8424 -4957.392 NA NULL NULL NA
lp://AUSD/KINT 1,117,207.247 -928.8803 -5159.229 26,119.883 1371.761 16643.61 1,091,087.363286
lp://AUSD/PHA 892,564.165 -690.5932 -4909.752 64,089.355 4428.408 26503.23 828,474.810115
lp://AUSD/KBTC 920,618.364 0 -5881.297 521,719.728 9055.078 163319.6 398,898.635508
lp://TAI/taiKSM 0.000 0 0 15,994.240 8.889366 2219.994 15,994.240499
lp://KSM/ARIS 3,493.867 15.90605 646.2033 6,987.734 31.91622 3396.389 3,493.866690
lp://KAR/KSM 1,182,259.771 5634.094 417435.1 1,185,289.709 5634.844 423286.2 3,029.937137
lp://KAR/LKSM 827,243.927 2486.023 139482.3 829,793.737 2478.381 155488 2,549.809946
lp://AUSD/CSM 189,071.607 15165.68 43036.23 188,584.394 31648.85 115413.6 487.212853
lp://AUSD/BNC 80,887.596 354.0175 17633.81 80,640.987 354.0175 18350.25 246.608894
lp://AUSD/KSM 684,280.078 6445.76 771925.2 684,135.530 6445.76 785368.3 144.547824
lp://KAR/QTZ 20,725.498 84.60858 4142.145 20,616.469 87.08394 5374.786 109.029340
lp://AUSD/QTZ 25,468.784 84.18706 3622.208 25,375.903 84.32557 11180.87 92.881270
lp://AUSD/LKSM 601,242.561 3055.305 272779.1 601,304.926 3055.185 348578.6 62.365126
lp://KSM/LKSM 202,357.704 335.2285 87358.64 202,310.383 334.1142 90002.42 47.320738
lp://KAR/AUSD 457,914.719 13873.32 205270.2 457,891.431 13881.85 450214.2 23.288714
lp://KSM/RMRK 63,105.844 353.6122 46795.58 63,100.764 353.6521 49839.01 5.079971
lp://AUSD/RMRK 34,378.320 189.7249 20091.65 34,373.609 189.7257 20122.03 4.710207
---
title: "Acala / Karura Pool Stats"
output:
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: scroll
    social: menu
    source_code: embed
---

```{css custom1, echo=FALSE}
.dataTables_scrollBody {
    max-height: 100% !important;
}
```

```{r global, include=FALSE}

library(knitr)
knitr::opts_chunk$set(
  message = FALSE,
  warning = FALSE,
  comment = "#>"
)

library(kableExtra)
library(formattable)
library(lubridate)
library(flexdashboard)
library(DT)
library(subscanr)
library(ghql)
x <- GraphqlClient$new()

# Helper function to concat
`%+%` <- function(a, b) paste0(a, b)

# library(reticulate)

```

```{r tokens, cache = TRUE, include=FALSE}

pools_k <- getPoolStats_acala('karura')
# FOR DEX must use dailyTradeVolumeUSD instead of tradeVolumeUSD
pools_k_dex <- getPoolStats_acala_dex('karura')
setnames(pools_k_dex, "totalTVL", "tvlUSD_DEX")

pools_k[, .(id, token0.name, token1.name)]

both_k <- merge(pools_k[, .(id, tvlUSD, volumeUSD_24H, volumeUSD_7D)],
                pools_k_dex[, .(id, tvlUSD_DEX, volumeUSD_24H, volumeUSD_7D)],
                by = "id",
                all = TRUE,
                suffixes = c("", "_DEX"))
both_k[, TVL_Difference := abs(tvlUSD - tvlUSD_DEX)] %>% 
  setorder(-TVL_Difference)

pools_a <- getPoolStats_acala('acala')
pools_a_dex <- getPoolStats_acala_dex('acala')
setnames(pools_a_dex, "totalTVL", "tvlUSD_DEX")

both_a <- merge(pools_a[, .(id, tvlUSD, volumeUSD_24H, volumeUSD_7D)],
                pools_a_dex[, .(id, tvlUSD_DEX, volumeUSD_24H, volumeUSD_7D)],
                by = "id",
                all = TRUE,
                suffixes = c("", "_DEX"))
both_a[, TVL_Difference := abs(tvlUSD - tvlUSD_DEX)] %>% 
  setorder(-TVL_Difference)

```

# Acala {.tabset}

Row
----

```{r acala1}

knitr::kable(both_a, escape = FALSE, format.args = list(big.mark = ",")) %>%
  kable_styling()

```


# Karura {.tabset}

Row
----

```{r karura1}

knitr::kable(both_k, escape = FALSE, format.args = list(big.mark = ",")) %>%
  kable_styling()

```